package com.hmdp.ThreadUtil;

import jodd.time.TimeUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author:fengxiaohui
 * @Description:
 * @Date:Create in 3:04 下午 2023/6/4
 * @Modified By:
 */
public class ThreadMethodDemo {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread("t1"){
            @Override
            public void run() {
                System.out.println("=================Thread: " + Thread.currentThread().getName()+"======================running==============");
            }
        };

        System.out.println(t1.getState());
        t1.start();
        System.out.println(t1.getState());

        System.out.println(t1.getState());


    }
}
@Slf4j(topic = "ThreadLearn")
class ThreadJoin{

    static int a = 0;

    public static void main(String[] args) throws InterruptedException {
        test01();

    }

    private static void test01() throws InterruptedException {
        Thread t1 = new Thread(()-> {
            log.debug("begin....");
            try {
                Thread.sleep(5);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("end...");
            a = 10;
        },"t1");
        t1.start();
        t1.join(1);
        log.debug("结果为： {}",a);
        log.debug("over...");
    }
}
